<?php

namespace App\Http\Controllers\Admin;

use App\Models\UserPointRecord;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class UserPointController extends BaseController
{
    public function index()
    {

        $items = UserPointRecord::with('user')->orderByDesc('id')->paginate(20);

        return $this->view('admin.commission.points', [
            'items'=>$items,
            'pagination'=>$items->render()
        ]);
    }

    public function batchDelete(Request $request)
    {
        $delete = $request->input('delete');
        if ($delete)
        {
            foreach ($delete as $id)
            {
                UserPointRecord::where('id', $id)->delete();
            }
        }

        return ajaxReturn();
    }
}
